package com.yygo.jobs;

import com.yygo.model.LoanRequest;
import com.yygo.model.Rule;
import com.yygo.service.LoanRequestManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by tiansha on 2015/7/9.
 */
@Component("F009")
public class F009 extends BaseRuleProcessor implements RuleProcessor {

    @Autowired
    private LoanRequestManager loanRequestManager;

    @Override
    public Rule process(LoanRequest loanRequest) {
        int count = loanRequestManager.getRecentRequestCountByDealer(loanRequest.getDealer(), 10);
        if (count >= 10) {
            Rule rule = new Rule("F009", "该经销商最近一周申请记录过多");
            return rule;
        }
        return null;
    }
}
